# coding: utf-8
from sqlalchemy import Column, Date, DateTime, String
from sqlalchemy.dialects.mysql import INTEGER, TINYINT
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()
metadata = Base.metadata


class TbAdminFrameTable(Base):
    __tablename__ = 'tb_admin_frame_table'
    __table_args__ = {'comment': '储存管理员框架界面表格数据'}

    User_ID = Column(String(30), primary_key=True, nullable=False, comment='用户ID')
    Proj_ID = Column(String(30), primary_key=True, nullable=False, comment='用户ID')
    frame_Data = Column(String(500))


class TbAdminPage1Info(Base):
    __tablename__ = 'tb_admin_page1_info'
    __table_args__ = {'comment': '管理员界面数据表1'}

    User_ID = Column(String(30), primary_key=True, nullable=False, comment='用户ID')
    Proj_ID = Column(String(30), primary_key=True, nullable=False, comment='用户ID')
    Page_Data = Column(String(500), comment='界面数据')


class TbAdminPage2Info(Base):
    __tablename__ = 'tb_admin_page2_info'
    __table_args__ = {'comment': '管理员界面数据表2'}

    User_ID = Column(String(30), primary_key=True, nullable=False, comment='用户ID')
    Proj_ID = Column(String(30), primary_key=True, nullable=False, comment='用户ID')
    Page_Data = Column(String(500), comment='界面数据')


class TbAdministrator(Base):
    __tablename__ = 'tb_administrator'
    __table_args__ = {'comment': '管理员信息表'}

    User_ID = Column(String(10), primary_key=True, comment='用户ID')
    User_Name = Column(String(10), comment='用户名')
    User_PWD = Column(String(500), comment='密码')
    User_Role = Column(String(10), comment='用户角色')
    Belong_Depart = Column(String(100), comment='所在部门')
    Job_Name = Column(String(50), comment='所在岗位')
    User_TruName = Column(String(10), comment='真实姓名')
    User_MobileNumber = Column(String(11), comment='手机号码')
    User_Email = Column(String(50), comment='电子邮箱')
    Register_Date = Column(Date, comment='注册日期')
    IsQualified = Column(TINYINT(4), comment='授权状态')
    Check_Date = Column(Date, comment='审核日期')
    Check_Name = Column(String(50), comment='审核人名称')
    Update_Date = Column(DateTime, comment='更新日期')
    Remark = Column(String(200), comment='备注')
    LegalPerson_ID = Column(INTEGER(11), comment='法人ID')


class TbDbversion(Base):
    __tablename__ = 'tb_dbversion'
    __table_args__ = {'comment': '库表版本信息'}

    sysDB_modName = Column(String(30), primary_key=True, nullable=False, comment='系统库模板名')
    sysDB_Version = Column(String(20), primary_key=True, nullable=False, comment='系统库版本号')
    Release_Date = Column(Date, comment='发布日期')
    Remarks = Column(String(200), comment='备注')


class TbLicense(Base):
    __tablename__ = 'tb_license'
    __table_args__ = {'comment': '授权信息表'}

    LegalPerson_ID = Column(INTEGER(11), primary_key=True, comment='法人ID')
    LegalPeson_Name = Column(String(50), comment='法人名称')
    LegalPeson_Code = Column(String(20), comment='机构代码')
    LegalPeson_Representative = Column(String(10), comment='法人代表')
    Auth_serial_number = Column(String(100), comment='授权序列号')
    IsQualified = Column(TINYINT(4), comment='授权状态')
    Authed_StartDate = Column(Date, comment='授权日期')
    Authed_EndDate = Column(Date, comment='授权截止日期')
    Authed_Online_Number = Column(INTEGER(11), comment='限定在线数')
    User_DB_constr = Column(String(200), comment='用户库连接串')
    Auth_devname = Column(String(10), comment='授权人')
    License_Remarks = Column(String(100), comment='授权说明')


class TbUser(Base):
    __tablename__ = 'tb_user'
    __table_args__ = {'comment': '用户信息表'}

    User_ID = Column(String(10), primary_key=True, comment='用户ID')
    User_Name = Column(String(10), comment='用户名')
    User_PWD = Column(String(1000), comment='密码')
    User_Role = Column(String(10), comment='用户角色')
    Belong_Depart = Column(String(100), comment='所在部门')
    Job_Name = Column(String(50), comment='所在岗位')
    User_TruName = Column(String(10), comment='真实姓名')
    User_MobileNumber = Column(String(20), comment='手机号码')
    User_Email = Column(String(50), comment='电子邮箱')
    Register_Date = Column(Date, comment='注册日期')
    IsQualified = Column(TINYINT(4), comment='授权状态')
    Check_Date = Column(Date, comment='审核日期')
    Check_Name = Column(String(255), comment='审核人名称')
    Update_Date = Column(Date, comment='更新日期')
    Remark = Column(String(255), comment='备注')
    LegalPerson_ID = Column(INTEGER(11), comment='法人ID')
    Online = Column(INTEGER(2), nullable=False)


class TbUserorgFramework(Base):
    __tablename__ = 'tb_userorg_framework'
    __table_args__ = {'comment': '用户组织机构信息表'}

    Depart_ID = Column(INTEGER(10), primary_key=True, nullable=False, comment='部门ID')
    Depart_Name = Column(String(50), primary_key=True, nullable=False, comment='部门名称')
    Depart_Rank = Column(String(10), comment='部门层级')
    Belong_Depart_ID = Column(String(20), comment='隶属部门ID')
    Remark = Column(String(200), comment='备注')
    LegalPerson_ID = Column(INTEGER(20), comment='法人ID')
